const express = require("express");
const db = require("./sql/db");

// 登录模块
const login = require('./moduls/login/login');
// 权限管理
const addstaffs = require('./moduls/users/addusers')
const getstaffs = require('./moduls/users/getusers')
const delstaffs = require('./moduls/users/delusers')
const updatestaffs = require('./moduls/users/updateusers')
// 饲料模块
const getfeedrecords = require('./moduls/feedrecords/getfeedrecords')
const addfeeds = require('./moduls/feeds/addfeeds')
// 药品模块
const getdrugsrecords = require('./moduls/drugsrecords/getdrugsrecords')
const adddrugs = require('./moduls/drugs/adddrugs')

// 牛只资料
const addcattles = require("./moduls/cattles/addcattles");
const getcattles = require('./moduls/cattles/getcattles')
const updatecattles = require('./moduls/cattles/updatecattles')
// 场内移动
const getcattlesmoves = require('./moduls/cattlesmove/getcattlesmoves')
const addcattlesmoves = require('./moduls/cattlesmove/addcattlesmove')
const delcattlesmoves = require('./moduls/cattlesmove/delcattlesmove')
// 离场情况
const addcattlesout = require('./moduls/cattlesout/addcattlesout')
const getcattlesout = require('./moduls/cattlesout/getcattlesout')

// 舍存情况
const addcattlessurplus = require('./moduls/cattlessurplus/addcattlessurplus')
const getcattlessurplus = require('./moduls/cattlessurplus/getcattlessurplus')
const updatecattlessurplus = require('./moduls/cattlessurplus/updatecattlessurplus')
const searchcattlessurplus = require('./moduls/cattlessurplus/searchcattlessurplus')
// 妊娠检查提醒
const getpregnancys = require('./moduls/pregnancys/getpregnancy')
const addpregnancys = require('./moduls/pregnancys/addpregnancys')
// 妊娠诊断提醒
const getdiagnosis = require('./moduls/diagnosis/getdiagnosis');
const adddiagnosis = require('./moduls/diagnosis/adddiagnosis')
// 断奶提醒
const getweanings = require('./moduls/weanings/getweanings')
const addweanings = require('./moduls/weanings/addweanings')

const app = express();
const formidableMiddleware = require('express-formidable');//解析表格
app.use(formidableMiddleware()); //挂载


//登录模块
app.post("/login",login)
// 权限管理
app.post('/addstaffs',addstaffs)
app.post('/getstaffs',getstaffs)
app.post('/delstaffs',delstaffs)
app.post('/updatestaffs',updatestaffs)

//饲料模块
app.post("/getfeedrecords",getfeedrecords); // 获取饲料入库记录
app.post('/addfeeds',addfeeds)
// 药品模块
app.post('/getdrugsrecords',getdrugsrecords) //获取药品入库记录
app.post('/adddrugs',adddrugs)

// 牛只资料
app.post('/addcattles',addcattles)
app.post('/getcattles',getcattles)
app.post('/updatecattles',updatecattles)

// 场内移动
app.post('/getcattlesmoves',getcattlesmoves)
app.post('/addcattlesmoves',addcattlesmoves)
app.post('/delcattlesmoves',delcattlesmoves)

// 离场情况
app.post('/addcattlesout',addcattlesout)
app.post("/getcattlesout",getcattlesout)

// 舍存情况
app.post('/addcattlessurplus',addcattlessurplus)
app.post('/getcattlessurplus',getcattlessurplus)
app.post('/updatecattlessurplus',updatecattlessurplus)
app.post('/searchcattlessurplus',searchcattlessurplus)

// 智能提醒
// 妊娠检查提醒
app.post('/getpregnancys',getpregnancys)
app.post('/addpregnancys',addpregnancys)
// 妊娠诊断提醒
app.post('/getdiagnosis',getdiagnosis)
app.post('/adddiagnosis',adddiagnosis)
// 断奶提醒
app.post('/getweanings',getweanings)
app.post('/addweanings',addweanings)


app.listen(12345,()=>{
  console.log("服务器连接成功");
})
